<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui">


    <ui:define name="content">

        <h:panelGroup >
            <h:form  >
                <p:commandButton ajax="false" value="Back to Intrim"
                                action="/inward/inward_bill_intrim" onclick="onSubmitButton();"/>
                <p:dataTable value="#{bhtSummeryController.billItems}" var="ser"
                             rowStyleClass="#{(ser.bill.billClass eq 'class com.divudi.entity.BilledBill')? '':'noDisplayRow'}">
                    <p:column headerText="Services Name">
                        #{ser.item.name}
                    </p:column>          
                    <p:column headerText="Returned">
                        <h:outputLabel  rendered="#{ser.refunded}" value="Returned" style="color: red;"/>
                    </p:column>          
                    <p:column headerText="Gross Value">
                        <h:outputLabel value="#{ser.grossValue}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column headerText="Margin Value">
                        <h:outputLabel value="#{ser.marginValue}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column headerText="Net Value">
                        <h:outputLabel value="#{ser.netValue}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column headerText="Created At">
                        <h:outputLabel value="#{ser.bill.createdAt}">
                            <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                        </h:outputLabel>                                                   
                        <br/>
                        <h:panelGroup rendered="#{ser.bill.cancelled}" >
                            <h:outputLabel style="color: red;" value="Cancelled at " />
                            <h:outputLabel style="color: red;" rendered="#{ser.bill.cancelled}" 
                                           value="#{ser.bill.cancelledBill.createdAt}" >
                                <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                            </h:outputLabel>
                        </h:panelGroup>
                    </p:column>

                    <p:column >
                        <h:outputLabel value="#{ser.bill.creater.webUserPerson.name}"/>     
                        <br/>
                        <h:panelGroup rendered="#{ser.bill.cancelled}" >
                            <h:outputLabel style="color: red;" value="Cancelled By " />
                            <h:outputLabel style="color: red;" rendered="#{ser.bill.cancelled}" 
                                           value="#{ser.bill.cancelledBill.creater.webUserPerson.name}" >                                       
                            </h:outputLabel>
                        </h:panelGroup>
                    </p:column>   
                    <p:column headerText="Edited">
                        <h:panelGroup  rendered="#{ser.bill.editor ne null}" >
                            <h:outputLabel style="color: #008000;" value="Edited By " />
                            <h:outputLabel style="color: #008000;" 
                                           value="#{ser.bill.editor.webUserPerson.name}" >
                            </h:outputLabel>
                        </h:panelGroup>
                        <h:panelGroup  rendered="#{ser.bill.editedAt ne null}" >
                            <h:outputLabel style="color: #008000;" value="Edited at " />
                            <h:outputLabel style="color: #008000;" 
                                           value="#{ser.bill.editedAt}" >
                                <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                            </h:outputLabel>
                        </h:panelGroup>
                    </p:column>
                    <p:column headerText="Checked">
                        <h:panelGroup  rendered="#{ser.bill.checkedBy ne null}" >
                            <h:outputLabel style="color: #008000;" value="Checked By " />
                            <h:outputLabel style="color: #008000;" 
                                           value="#{ser.bill.checkedBy.webUserPerson.name}" >
                            </h:outputLabel>
                        </h:panelGroup><br/>
                        <h:panelGroup  rendered="#{ser.bill.checkeAt ne null}" >
                            <h:outputLabel style="color: #008000;" value="Checked at " />
                            <h:outputLabel style="color: #008000;" 
                                           value="#{ser.bill.checkeAt}" >
                                <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                            </h:outputLabel>
                        </h:panelGroup>                        
                    </p:column>
                    <p:column headerText="Description">
                        #{ser.descreption}
                    </p:column>
                    <p:column headerText="Billed Id" rendered="false">
                        #{ser.bill.id}
                    </p:column>
                    <p:column headerText="Cancelled Id" rendered="false">
                        #{ser.bill.cancelledBill.id}
                    </p:column>
                    <p:column>
                        <p:commandButton ajax="false" action="inward_edit_bill_item"  value="View Bill Fee Break Down" onclick="onSubmitButton();" >                                              
                            <f:setPropertyActionListener value="#{ser}" target="#{serviceFeeEdit.billItem}"/>
                        </p:commandButton>
                    </p:column>
                    <p:column>
                        <p:commandButton ajax="false" action="inward_reprint_bill_service" 
                                         value="View Bill" onclick="onSubmitButton();" 
                                        actionListener="#{inwardSearch.selectBillItem(ser)}" >  
                        </p:commandButton>
                    </p:column>

                </p:dataTable>
            </h:form>

        </h:panelGroup>

    </ui:define>

</ui:composition>
